package com.cyq.day27.hashmap;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class HashMapDemo {
    public static void main(String[] args) {
        Map<Integer,String> map=new HashMap<Integer,String>();
        map.put(1,"aaa");
        map.put(2,"bbb");
//        map.get(1);
//        Collection<String> values =  map.values();
//        for (String s:values) {
//            System.out.println(s);
//        }
        Set<Map.Entry<Integer, String>> entries = map.entrySet();
        Iterator<Map.Entry<Integer, String>> iterator = entries.iterator();
        while (iterator.hasNext()){
            Map.Entry<Integer, String> next = iterator.next();
            System.out.println(next.getKey()+"+"+next.getValue());
        }
    }
}
